#!/usr/bin/perl
# 
#  Exercise 6.5 
# 
# Write a subroutine to check if a file exists, is a regular file, and is nonzero in size. 
# Use the file test operators (See Appendix B).
#
# Answer for Exercise 6.5

use strict;
use warnings;

my $file = 'exer06.05';

if ( file_passes_tests ) {

	print "File $file exists, is a regular file, and is nonzero in size\n";
}

exit;

sub file_passes_tests {

	my($file) = @_;

	if ( -e $file and -f $file and -s $file) {
		return 1;
	}else{
		return 0;
	}
}
